/**
* @author Ashish Gupta
* CVSSP, University of Surrey
* Copyright (c) 2010 Ashish Gupta
* All rights reserved.
*/
/**
 * 
 */
package genetic;

import java.util.Random;

import configuration.GenePoolConfiguration;

/**
 * @author Ashish
 * PointMutation alters the association of one cell identifier with one gene. This is equivalent to
 * taking one cell (and its feature vectors in the training and validation data-set) and placing it in
 * another bin in the visual code-book. The histogram of images with feature-vectors belonging to
 * that cell will accordingly be modified.
 */
public class PointMutation implements GeneticOperator {

	/* (non-Javadoc)
	 * @see genetic.GeneticOperator#operate(java.lang.Object)
	 */
	
	@Override
	public Object operate(Object genes) {
		// TODO Auto-generated method stub
		return null;
	}

	/* (non-Javadoc)
	 * @see genetic.GeneticOperator#operate(genetic.GeneMap)
	 */
	/**
	 * @return GeneMap
	 *  PointMutation operator changes a single association of cell to gene and return a GeneMap.
	 *  A cell is randomly selection from the set of keys and its association is made with a randomly
	 *  selected value.
	 */
	@Override
	public Object operate(GeneMap map) {
		Random rnd = new Random();
		int keyIdx = rnd.nextInt(map.keys().size()); // the key to be mutated
		int valueIdx = rnd.nextInt(map.values().size()); // the key whose value will be put in mutated key
		Integer newValue = map.get(valueIdx); // the value to be placed in the mutated key
		map.put(keyIdx, newValue);
		return map;
	}

	/* (non-Javadoc)
	 * @see genetic.GeneticOperator#operate(genetic.GeneMap, configuration.GenePoolConfiguration)
	 */
	@Override
	public Object operate(GeneMap map, GenePoolConfiguration genePoolConfig) {
		// TODO Auto-generated method stub
		return null;
	}

	/* (non-Javadoc)
	 * @see genetic.GeneticOperator#operate(genetic.GeneMap, genetic.GeneMap, configuration.GenePoolConfiguration)
	 */
	@Override
	public Object operate(GeneMap mapFather, GeneMap mapMother,
			GenePoolConfiguration genePoolConfig) {
		// TODO Auto-generated method stub
		return null;
	}

}
